set more off 
mata: mata set matafavor speed, perm

use "E:\隨身硬碟備份\E\TRY\findev_2017\Fin_Co2_pol_2020\program\n82_4y_8417_renew.dta",clear
tsset id period
drop if id==45
drop if id==76

egen right_a=mean(sc_right),  by(id)
tabstat right_a, stat(p10 p25 p50 p75 p90 mean)


use "E:\隨身硬碟備份\E\TRY\findev_2017\Fin_Co2_pol_2018\submit\version3_202007\Program\n82_4y_fin_202005.dta",clear
tsset id period

***Table 6.Marginal effects of finance, evaluated at various values of political rights***

** Panel B: Energy us per capita percapita-political right**

*FS aggregate*
xtabond2 lnav_engpc c.fin_dev c.fin_dev#c.sc_right c.fin_str c.fin_str#c.sc_right c.sc_right ///
c.lnav_gdp c.lnav_gdp#c.lnav_gdp ln_engpc0 ln_trad0 ln_urb0 ln_sec0 ln_inds0, ///
gmm(c.fin_dev, lag(1 1))                gmm(c.fin_dev#c.sc_right, lag(2 2) collapse) ///
gmm(c.fin_str, lag(2 2) orthogonal)     gmm(c.fin_str#c.sc_right, lag(2 2) collapse) ///
gmm(c.sc_right,lag(2 2) collapse) ///
gmm(c.lnav_gdp,lag(1 2))                gmm(c.lnav_gdp#c.lnav_gdp,lag(1 2)) ///  
iv(ln_engpc0 ln_trad0 ln_urb0 ln_sec0 ln_inds0) ///
twostep small

margins, dydx(c.fin_dev) at(sc_right=0.0038)
margins, dydx(c.fin_dev) at(sc_right=0.0479)
margins, dydx(c.fin_dev) at(sc_right=0.1739)
margins, dydx(c.fin_dev) at(sc_right=0.4412)
margins, dydx(c.fin_dev) at(sc_right=0.9444)
margins, dydx(c.fin_dev) at(sc_right=1)
margins, dydx(c.fin_dev) at(sc_right=0.5249)

margins, dydx(c.fin_str) at(sc_right=0.0038)
margins, dydx(c.fin_str) at(sc_right=0.0479)
margins, dydx(c.fin_str) at(sc_right=0.1739)
margins, dydx(c.fin_str) at(sc_right=0.4412)
margins, dydx(c.fin_str) at(sc_right=0.9444)
margins, dydx(c.fin_str) at(sc_right=1)
margins, dydx(c.fin_str) at(sc_right=0.5249)

*boone*
xtabond2 lnav_engpc c.fin_dev c.fin_dev#c.sc_right c.av_bon c.av_bon#c.sc_right c.sc_right ///
c.lnav_gdp c.lnav_gdp#c.lnav_gdp ln_engpc0 ln_trad0 ln_urb0 ln_sec0 ln_inds0, ///
gmm(c.fin_dev,    lag(1 3))               gmm(c.fin_dev#c.sc_right, lag(1 2)orthogonal) ///
gmm(c.av_bon,     lag(1 4)orthogonal)     gmm(c.av_bon#c.sc_right,  lag(2 3)) ///
gmm(c.sc_right,   lag(1 1)) ///
gmm(c.lnav_gdp,   lag(3 3))    gmm(c.lnav_gdp#c.lnav_gdp,  lag(1 1) ) ///  
iv(ln_engpc0 ln_trad0 ln_urb0 ln_sec0 ln_inds0) ///
twostep small

margins, dydx(c.av_bon) at(sc_right=0.0038)
margins, dydx(c.av_bon) at(sc_right=0.0479)
margins, dydx(c.av_bon) at(sc_right=0.1739)
margins, dydx(c.av_bon) at(sc_right=0.4412)
margins, dydx(c.av_bon) at(sc_right=0.9444)
margins, dydx(c.av_bon) at(sc_right=1)
margins, dydx(c.av_bon) at(sc_right=0.5249)


*lerner*
xtabond2 lnav_engpc c.fin_dev c.fin_dev#c.sc_right c.av_lern c.av_lern#c.sc_right c.sc_right ///
c.lnav_gdp c.lnav_gdp#c.lnav_gdp ln_engpc0 ln_trad0 ln_urb0 ln_sec0 ln_inds0, ///
gmm(c.fin_dev,    lag(1 2) orthogonal)   gmm(c.fin_dev#c.sc_right, lag(1 2)) ///
gmm(c.av_lern,    lag(1 1))              gmm(c.av_lern#c.sc_right, lag(3 3) orthogonal) ///
gmm(c.sc_right,   lag(2 3) orthogonal) ///
gmm(c.lnav_gdp,   lag(2 3))  gmm(c.lnav_gdp#c.lnav_gdp,  lag(1 2)) ///  
iv(ln_engpc0 ln_trad0 ln_urb0 ln_sec0 ln_inds0) ///
twostep small

margins, dydx(c.av_lern) at(sc_right=0.0038)
margins, dydx(c.av_lern) at(sc_right=0.0479)
margins, dydx(c.av_lern) at(sc_right=0.1739)
margins, dydx(c.av_lern) at(sc_right=0.4412)
margins, dydx(c.av_lern) at(sc_right=0.9444)
margins, dydx(c.av_lern) at(sc_right=1)
margins, dydx(c.av_lern) at(sc_right=0.5249)


*concerntration*
xtabond2 lnav_engpc c.fin_dev c.fin_dev#c.sc_right c.lnav_concn c.lnav_concn#c.sc_right c.sc_right ///
c.lnav_gdp c.lnav_gdp#c.lnav_gdp ln_engpc0 ln_trad0 ln_urb0 ln_sec0 ln_inds0, ///
gmm(c.fin_dev,    lag(4 4) orthogonal)   gmm(c.fin_dev#c.sc_right,  lag(2 2)) ///
gmm(c.lnav_concn, lag(3 3) collapse)     gmm(c.lnav_concn#c.sc_right, lag(1 4)) ///
gmm(c.sc_right,   lag(1 2)) ///
gmm(c.lnav_gdp,   lag(2 3))    gmm(c.lnav_gdp#c.lnav_gdp,  lag(1 3)) ///  
iv(ln_engpc0 ln_trad0 ln_urb0 ln_sec0 ln_inds0) ///
twostep small

margins, dydx(c.lnav_concn) at(sc_right=0.0038)
margins, dydx(c.lnav_concn) at(sc_right=0.0479)
margins, dydx(c.lnav_concn) at(sc_right=0.1739)
margins, dydx(c.lnav_concn) at(sc_right=0.4412)
margins, dydx(c.lnav_concn) at(sc_right=0.9444)
margins, dydx(c.lnav_concn) at(sc_right=1)
margins, dydx(c.lnav_concn) at(sc_right=0.5249)


*credit composition*
xtabond2 lnav_engpc c.lnav_borhh c.lnav_borhh#c.sc_right c.lnav_borfm c.lnav_borfm#c.sc_right c.sc_right ///
c.lnav_gdp c.lnav_gdp#c.lnav_gdp ln_engpc0 ln_trad0 ln_urb0 ln_sec0 ln_inds0, ///
gmm(c.lnav_borhh, lag(1 3) collapse)         gmm(c.lnav_borhh#c.sc_right, lag(1 3) orthogonal) ///
gmm(c.lnav_borfm, lag(3 3) orthogonal)       gmm(c.lnav_borfm#c.sc_right, lag(2 2) orthogonal) ///
gmm(c.sc_right,   lag(2 2) collapse) ///
gmm(c.lnav_gdp,   lag(2 2))   gmm(c.lnav_gdp#c.lnav_gdp,   lag(1 2)) ///  
iv(ln_engpc0 ln_trad0 ln_urb0 ln_sec0 ln_inds0) ///
twostep small

margins, dydx(c.lnav_borhh) at(sc_right=0.0038)
margins, dydx(c.lnav_borhh) at(sc_right=0.0479)
margins, dydx(c.lnav_borhh) at(sc_right=0.1739)
margins, dydx(c.lnav_borhh) at(sc_right=0.4412)
margins, dydx(c.lnav_borhh) at(sc_right=0.9444)
margins, dydx(c.lnav_borhh) at(sc_right=1)
margins, dydx(c.lnav_borhh) at(sc_right=0.5249)

margins, dydx(c.lnav_borfm) at(sc_right=0.0038)
margins, dydx(c.lnav_borfm) at(sc_right=0.0479)
margins, dydx(c.lnav_borfm) at(sc_right=0.1739)
margins, dydx(c.lnav_borfm) at(sc_right=0.4412)
margins, dydx(c.lnav_borfm) at(sc_right=0.9444)
margins, dydx(c.lnav_borfm) at(sc_right=1)
margins, dydx(c.lnav_borfm) at(sc_right=0.5249)
 
